#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ls (x << 1)
#define rs (x << 1 | 1)
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

int n, m;
vector<int> g[N];
int fa[N], son[N], dep[N], siz[N], e[N];
int top[N], dfn[N], seg[N], cntd = 0;

void dfs1(int x, int f)
{
    fa[x] = f;
    dep[x] = dep[f] + 1;
    siz[x] = 1;son[x] = 0;
    int min_son = -1;
    for (int y : g[x]) {
        if (y == f) continue;
        dfs1(y, x);
        siz[x] += siz[y];
        if (min_son < siz[y]) son[x] = y, min_son = siz[y];
    }
}
void dfs2(int x, int t)
{
    top[x] = t;
    dfn[x] = ++cntd;
    seg[cntd] = x;
    if (son[x] == 0) return;
    dfs2(son[x], t);
    for (int y : g[x]) {
        if (y == fa[x] || y == son[x]) continue;
        dfs2(y, y);
    }
}

struct node { int l, r, v; }tr[N << 2];
void pushup(int x) { tr[x].v = tr[ls].v ^ tr[rs].v; }
void build(int x, int l, int r)
{
    tr[x].l = l, tr[x].r = r;
    if (l == r) { tr[x].v = e[seg[l]]; return; }
    int mid = (l + r) >> 1;
    build(ls, l, mid);build(rs, mid + 1, r);
    pushup(x);
}
void modify(int x, int p, int d)
{
    if (tr[x].l == p && tr[x].r == p) {
        tr[x].v = d;
    } else {
        int mid = (tr[x].l + tr[x].r) >> 1;
        if (p <= mid) modify(ls, p, d);
        else modify(rs, p, d);
        pushup(x);
    }
}
int query(int x, int l, int r)
{
    if (l <= tr[x].l && tr[x].r <= r)  return tr[x].v;
    int mid = (tr[x].l + tr[x].r) >> 1, res = 0;
    if (l <= mid) res ^= query(ls, l, r);
    if (r > mid) res ^= query(rs, l, r);
    return res;
}

void change(int x, int d) { modify(1, dfn[x], d); }
int ask_range(int x, int y)
{
    int res = 0;
    while (top[x] != top[y]) {
        if (dep[top[x]] < dep[top[y]]) swap(x, y);
        res ^= query(1, dfn[top[x]], dfn[x]);
        x = fa[top[x]];
    }
    if (dep[x] > dep[y]) swap(x, y);
    res ^= query(1, dfn[x], dfn[y]);
    return res;
}

void solve()
{
    cin >> n >> m;
    for (int i = 1;i <= n;i++) cin >> e[i];
    for (int i = 1;i < n;i++) {
        int a, b; cin >> a >> b;
        g[a].push_back(b);g[b].push_back(a);
    }
    dfs1(1, 0);dfs2(1, 1);
    build(1, 1, n);
    while (m--) {
        int op, x, y;cin >> op >> x >> y;
        if (op == 1) {
            change(x, y);
        } else {
            cout << ask_range(x, y) << '\n';
        }
    }
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}